import 'package:flutter/material.dart';
import 'package:aweb5/base/BaseWidget.dart';
import 'package:aweb5/util/WindowUtil.dart';
import 'package:aweb5/pages/Order.dart';
import 'package:aweb5/pages/Setting.dart';
import 'package:aweb5/pages/Coupon.dart';
class Member extends BaseWidget {
  @override
  State<Member> createState() => MemberState();
}

class MemberState extends BaseWidgetState<Member> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    init(context);
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xfff4f4f4),
        title: Text(
          "分类",
          style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
        ),
        centerTitle: true,
        elevation: 0,
      ),
      body: ListView(
        children: <Widget>[
          top(),
          InkWell(
            onTap: () {
              navigatorState.push(new MaterialPageRoute(builder: (c){return Order();}));
            },
            child: Container(
              padding: EdgeInsets.only(left: 10, right: 10),
              alignment: Alignment.center,
              width: WindowUtil.window_width,
              height: 36,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text(
                    "我的订单",
                    style: getStyle(),
                  ),
                  rightArrow()
                ],
              ),
            ),
          ),
          InkWell(
              onTap: () {},
              child: Container(
                height: 1,
                decoration: BoxDecoration(color: Color(0xfff4f4f4)),
              )),
          level2(),
          Container(
            height: 10,
            width: WindowUtil.window_width,
            color: Color(0xfff4f4f4),
          ),
          list()
        ],
      ),
    );
  }

  Widget top() {
    return Stack(
      children: <Widget>[
        Container(
          width: WindowUtil.window_width,
          height: 104,
          color: Color(0xffff8900),
          child: Row(
            //  crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              SizedBox(
                width: 20,
              ),
              Container(
                width: 56.0,
                height: 56.0,
                decoration: new BoxDecoration(
                  borderRadius: new BorderRadius.all(Radius.circular(31.0)),
                ),
                child: new ClipRRect(
                  borderRadius: BorderRadius.circular(50),
                  child: FadeInImage.assetNetwork(
                    placeholder: 'assets/touxiang.png',
                    image: '',
                    fit: BoxFit.cover,
                  ),
                ),
              ),
              SizedBox(
                width: 20,
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Text(
                    "昵称",
                    style: TextStyle(color: Color(0xffffffff), fontSize: 14),
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  Text(
                    "12343455",
                    style: TextStyle(color: Color(0xffffffff), fontSize: 14),
                  )
                ],
              ),
              Expanded(child: Text("")),
            ],
          ),
        ),
        Positioned(
          top: 10,
          right: 10,
          child: Container(
            alignment: Alignment.center,
            margin: EdgeInsets.only(top: 10, right: 10),
            width: 61,
            height: 20,
            decoration: BoxDecoration(
                color: Color(0x95000000),
                borderRadius: BorderRadius.circular(10)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Image.asset(
                  "assets/huiyuan.png",
                  width: 13,
                  height: 13,
                ),
                Text(
                  "会员",
                  style: TextStyle(color: Colors.white, fontSize: 12),
                )
              ],
            ),
          ),
        )
      ],
    );
  }

  TextStyle getStyle() {
    return TextStyle(color: Color(0xff000000), fontSize: 12);
  }

  Widget rightArrow() {
    return Image.asset(
      "assets/rightarrow.png",
      width: 8,
      height: 15,
    );
  }

  Widget level2() {
    return Container(
      width: WindowUtil.window_width,
      height: 75,
      margin: EdgeInsets.only(top: 16),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: <Widget>[
          InkWell(
            child: Column(
              children: <Widget>[
                Image.asset(
                  "assets/fukuan.png",
                  width: 25,
                  height: 25,
                ),
                Text(
                  "代付款",
                  style: TextStyle(color: Color(0xff2d2d2d), fontSize: 12),
                )
              ],
            ),
          ),
          InkWell(
            child: Column(
              children: <Widget>[
                Image.asset(
                  "assets/fahuo.png",
                  width: 25,
                  height: 25,
                ),
                Text(
                  "代发货",
                  style: TextStyle(color: Color(0xff2d2d2d), fontSize: 12),
                )
              ],
            ),
          ),
          InkWell(
            child: Column(
              children: <Widget>[
                Image.asset(
                  "assets/shouhuo.png",
                  width: 25,
                  height: 25,
                ),
                Text(
                  "代收货",
                  style: TextStyle(color: Color(0xff2d2d2d), fontSize: 12),
                )
              ],
            ),
          ),
        ],
      ),
    );
    ;
  }

  Widget list() {
    return ListView(
      shrinkWrap: true,
      physics: NeverScrollableScrollPhysics(),
      children: <Widget>[
        InkWell(
          onTap: () {
            navigatorState.push(new MaterialPageRoute(builder: (con){
              return Coupon();
            }));

          },
          child: Container(
            padding: EdgeInsets.only(left: 10, right: 10),
            alignment: Alignment.center,
            width: WindowUtil.window_width,
            height: 36,
            child: Row(
              children: <Widget>[
                Image.asset(
                  "assets/youhuiquan.png",
                  width: 13,
                  height: 13,
                ),
                SizedBox(
                  width: 6,
                ),
                Text(
                  "优惠券",
                  style: getStyle(),
                ),
                Expanded(child: Text("")),
                rightArrow()
              ],
            ),
          ),
        ),

        InkWell(
          onTap: () {},
          child: Container(
            padding: EdgeInsets.only(left: 10, right: 10),
            alignment: Alignment.center,
            width: WindowUtil.window_width,
            height: 36,
            child: Row(
              children: <Widget>[
                Image.asset(
                  "assets/jifen.png",
                  width: 13,
                  height: 13,
                ),
                SizedBox(
                  width: 6,
                ),
                Text(
                  "我的积分",
                  style: getStyle(),
                ),
                Expanded(child: Text("")),
                rightArrow()
              ],
            ),
          ),
        ),
        Container(height: 1,margin: EdgeInsets.only(left: 10,right: 10),color: Color(0xfff4f4f4),),
        InkWell(
          onTap: () {},
          child: Container(
            padding: EdgeInsets.only(left: 10, right: 10),
            alignment: Alignment.center,
            width: WindowUtil.window_width,
            height: 36,
            child: Row(
              children: <Widget>[
                Image.asset(
                  "assets/dizhi.png",
                  width: 13,
                  height: 13,
                ),
                SizedBox(
                  width: 6,
                ),
                Text(
                  "地址管理",
                  style: getStyle(),
                ),
                Expanded(child: Text("")),
                rightArrow()
              ],
            ),
          ),
        ),
        Container(height: 1,margin: EdgeInsets.only(left: 10,right: 10),color: Color(0xfff4f4f4),),
        InkWell(
          onTap: () {},
          child: Container(
            padding: EdgeInsets.only(left: 10, right: 10),
            alignment: Alignment.center,
            width: WindowUtil.window_width,
            height: 36,
            child: Row(
              children: <Widget>[
                Image.asset(
                  "assets/pinglun.png",
                  width: 13,
                  height: 13,
                ),
                SizedBox(
                  width: 6,
                ),
                Text(
                  "消息中心",
                  style: getStyle(),
                ),
                Expanded(child: Text("")),
                rightArrow()
              ],
            ),
          ),
        ),
        Container(height: 1,margin: EdgeInsets.only(left: 10,right: 10),color: Color(0xfff4f4f4),),
        InkWell(
          onTap: () {},
          child: Container(
            padding: EdgeInsets.only(left: 10, right: 10),
            alignment: Alignment.center,
            width: WindowUtil.window_width,
            height: 36,
            child: Row(
              children: <Widget>[
                Image.asset(
                  "assets/mendian.png",
                  width: 13,
                  height: 13,
                ),
                SizedBox(
                  width: 6,
                ),
                Text(
                  "附近门店",
                  style: getStyle(),
                ),
                Expanded(child: Text("")),
                rightArrow()
              ],
            ),
          ),
        ),
        Container(height: 1,margin: EdgeInsets.only(left: 10,right: 10),color: Color(0xfff4f4f4),),
        InkWell(
          onTap: () {
            navigatorState.push(new MaterialPageRoute(builder: (con){return Setting();}) );
          },
          child: Container(
            padding: EdgeInsets.only(left: 10, right: 10),
            alignment: Alignment.center,
            width: WindowUtil.window_width,
            height: 36,
            child: Row(
              children: <Widget>[
                Image.asset(
                  "assets/shezhi.png",
                  width: 13,
                  height: 13,
                ),
                SizedBox(
                  width: 6,
                ),
                Text(
                  "设置",
                  style: getStyle(),
                ),
                Expanded(child: Text("")),
                rightArrow()
              ],
            ),
          ),
        ),
      ],
    );
  }


}
